﻿Imports IICModel.BusObjects
Imports IICModel.BusObjects.Mappers
Imports IICBusinessLogic.PeriodProcessing
Imports IICModel.ConversionObjects.Mappers
Imports IICModel.ConversionObjects
Imports IICModel.DataConbversionLogic
Imports org.model.lib
Imports System.Security.Principal

Namespace DataConversion

    Public Class InitialConversion

        Public Shared Sub main()
            Try

                'just exit.  we do not need to run this code again
                Exit Sub

                Model.ModelContext.Current.CurrentUserName = BaseDataConverter.DATA_CONVERSION_USERNAME
                Model.ModelContext.CurrentDBUtils = BaseDataConverter.newDBConnection

                BaseDataConverter.newDBConnection.executeSQL("UPDATE STGIICDB.dbo.[CAND_SUB] set SUBJECT='GR10' WHERE SUBJECT = 'C010' AND EXAM_CENTRE = '02'")
                BaseDataConverter.newDBConnection.executeSQL("UPDATE STGIICDB.dbo.[CAND_SUB] set SUBJECT='GR20' WHERE SUBJECT = 'C020' AND EXAM_CENTRE = '02'")
                BaseDataConverter.newDBConnection.executeSQL("UPDATE STGIICDB.dbo.[CAND_SUB] set SUBJECT='GR30' WHERE SUBJECT = 'C030' AND EXAM_CENTRE = '02'")

                Call subjectConversion()
                Call MemberConversion()

                Call PVAKConversion() 'kantounas database conversion
                Call PASConversion() 'pistopiitiko asfalistikon spudon
                Call PXSConversion() 'pistipiitiko hrimatoikonomikon simvulon

                Call createOldPASSctructure()
                Call createNewDASSctructure()

                'Dim pers As List(Of Period) = PeriodDataUtils.findList("DiplomaSuperTypeId=2 order by PeriodDate")
                'Call ProcessPeriodList(pers)

                BaseDataConverter.newDBConnection.executeSQL("if exists(select * from sysobjects where id=object_id('PastExams')) drop table PastExams")
                Call createGradeMappings()

            Finally
                Model.ModelContext.release()
            End Try


        End Sub

        ''' <summary>
        ''' Converts data from the old kantounas database
        ''' that held pvak data
        ''' </summary>
        Public Shared Sub PVAKConversion()

            Console.WriteLine("Processing ΠΒΑΚ periods")

            Call fixPeriodNames()
            Call ProcessPVAKPeriods()

        End Sub

        ''' <summary>
        ''' Fixes the period names
        ''' </summary>
        Private Shared Sub fixPeriodNames()

            Dim pdb As New PeriodDBMapper()

            Dim pers As List(Of Period) = pdb.findAll
            For Each pr As Period In pers
                pr.PeriodName = Period.builtPeriodName(pr.PeriodDate.GetValueOrDefault)

            Next
            pdb.saveList(pers)

        End Sub

        Private Shared Sub MemberConversion()
            'member conversion
            Dim sc As New MEMBERSConverter
            sc.dataTransfer()

            Dim cc As New IICMemberStudentConverter
            cc.dataTransfer()

            Dim cms As New CANDIDATMemberStudentConverter
            cms.dataTransfer()

            'here(check) the name lefteris (ginete lefte)

        End Sub

        ''' <summary>
        ''' Imports the EXPeriods, Subjects, Members and IICMember tables
        ''' </summary>
        Public Shared Sub PASConversion()

            Console.WriteLine("PAS Conversion")
            Dim eprs As New EXPeriodsConverter
            eprs.dataTransfer()

            Dim pcc As New PASClassesConverter
            pcc.dataTransfer()

            Dim cscm As New PASCandSubClassMember
            cscm.dataTransfer()

        End Sub


        Public Shared Sub ProcessPeriodList(ByVal pers As List(Of Period))

            'process Period List
            For Each pr As Period In pers
                pr.IsOpen = True

                Console.WriteLine("Processing period " & pr.PeriodDescription)
                Dim dc As PeriodProcessor = New PeriodProcessor(pr)
                dc.PeriodProcessRunDate = pr.PeriodDate
                dc.processPeriodAndStoreToDatabase()

                pr.IsOpen = False

            Next

        End Sub

        Public Shared Sub PXSConversion()

            Dim sc As New PXSPeriodsConverter
            sc.dataTransfer()

            Dim cc As New PXSClassesConverter
            cc.dataTransfer()

            Dim cm As New PXSClassMember
            cm.dataTransfer()

            Dim pers As List(Of Period) = PeriodDataUtils.findList("DiplomaSuperTypeId=4 order by PeriodDate")
            Call ProcessPeriodList(pers)

        End Sub

        ''' <summary>
        ''' Calls the PeriodProcessor.process for the PVAK database periods
        ''' </summary>
        Public Shared Sub ProcessPVAKPeriods()

            Try
                Model.ModelContext.beginTrans()

                Dim pdb As New PeriodDBMapper()

                Dim pers As List(Of Period) = pdb.findAll()
                For Each pr As Period In pers
                    pr.IsOpen = True
                    'now we see if student1 above has earned the diploma as expected
                    Dim dc As PeriodProcessor = New PeriodProcessor(pr)
                    dc.PeriodProcessRunDate = pr.PeriodDate
                    dc.processPeriodAndStoreToDatabase()

                Next

                Model.ModelContext.commitTrans()
            Finally
                Model.ModelContext.rollbackTrans()

            End Try

        End Sub

        Private Shared Sub createGradeMappings()

            Dim periodclassDb As PeriodClassDBMapper = New PeriodClassDBMapper(BaseDataConverter.newDBConnection)
            Dim gmdb As GradeMappingDBMapper = New GradeMappingDBMapper(BaseDataConverter.newDBConnection)
            Dim gms As New List(Of GradeMapping)
            Dim classes As List(Of PeriodClass)

            classes = periodclassDb.findList("lessonid in (select lessonid from lesson where lessoncode={0})", "CFA")
            Console.WriteLine("Creating grade mappings for PXS periods")
            For Each p As PeriodClass In classes

                Dim gmd As GradeMapping = GradeMappingFactory.Create
                gmd.ClassId = p.ClassId
                gmd.GradeFrom = 0
                gmd.GradeTo = CType(p.PassGrade.GetValueOrDefault - 1, Integer?)
                gmd.GradeDescription = "ΑΠΟΤΥΧΙΑ"
                gmd.LetterGrade = "A"
                gms.Add(gmd)

                gmd = GradeMappingFactory.Create
                gmd.ClassId = p.ClassId
                gmd.GradeTo = 1000
                gmd.GradeFrom = CType(p.PassGrade.GetValueOrDefault - 1, Integer?)
                gmd.GradeDescription = "ΕΠΙΤΥΧΙΑ"
                gmd.LetterGrade = "E"
                gms.Add(gmd)

            Next

            'now do all PVAK periods (kantounas database)
            classes = periodclassDb.findList("PERIODid in (select periodid from period where DiplomaSuperTypeId=1)")

            Console.WriteLine("Creating grade mappings for ΠΒΑΚ periods")
            For Each p As PeriodClass In classes


                Dim gmd As GradeMapping = GradeMappingFactory.Create
                gmd.ClassId = p.ClassId
                gmd.GradeFrom = 0
                gmd.GradeTo = CType(p.Lesson.DefaultPassGrade.GetValueOrDefault - 1, Integer?)
                gmd.GradeDescription = "ΑΠΟΤΥΧΙΑ"
                gmd.LetterGrade = "A"
                gms.Add(gmd)

                gmd = GradeMappingFactory.Create
                gmd.GradeTo = 1000
                gmd.GradeFrom = CType(p.Lesson.DefaultPassGrade.GetValueOrDefault - 1, Integer?)
                gmd.GradeDescription = "ΕΠΙΤΥΧΙΑ"
                gmd.LetterGrade = "E"
                gmd.ClassId = p.ClassId
                gms.Add(gmd)


            Next


            Console.WriteLine("Creating grade mappings for PAS periods")
            classes = periodclassDb.findList("PERIODid in (select periodid from period where DiplomaSuperTypeId=2)")
            For Each p As PeriodClass In classes


                Dim gmd As GradeMapping = GradeMappingFactory.Create
                gmd.ClassId = p.ClassId
                gmd.GradeFrom = 0
                gmd.GradeTo = 39
                gmd.GradeDescription = "ΑΠΟΤΥΧΙΑ"
                gmd.LetterGrade = "U"
                gms.Add(gmd)

                gmd = GradeMappingFactory.Create
                gmd.ClassId = p.ClassId
                gmd.GradeFrom = 40
                gmd.GradeTo = 59
                gmd.GradeDescription = "ΑΠΟΤΥΧΙΑ"
                gmd.LetterGrade = "Z"
                gms.Add(gmd)

                gmd = GradeMappingFactory.Create
                gmd.ClassId = p.ClassId
                gmd.GradeFrom = 60
                gmd.GradeTo = 79
                gmd.GradeDescription = "ΑΠΟΤΥΧΙΑ"
                gmd.LetterGrade = "A"
                gms.Add(gmd)

                gmd = GradeMappingFactory.Create
                gmd.ClassId = p.ClassId
                gmd.GradeFrom = 80
                gmd.GradeTo = 99
                gmd.GradeDescription = "ΑΠΟΤΥΧΙΑ"
                gmd.LetterGrade = "Y"
                gms.Add(gmd)

                gmd = GradeMappingFactory.Create
                gmd.ClassId = p.ClassId
                gmd.GradeFrom = 100
                gmd.GradeTo = 109
                gmd.GradeDescription = "ΑΠΟΤΥΧΙΑ"
                gmd.LetterGrade = "X"
                gms.Add(gmd)

                gmd = GradeMappingFactory.Create
                gmd.ClassId = p.ClassId
                gmd.GradeFrom = 110
                gmd.GradeTo = 129
                gmd.GradeDescription = "ΕΠΙΤΥΧΙΑ"
                gmd.LetterGrade = "E"
                gms.Add(gmd)

                gmd = GradeMappingFactory.Create
                gmd.ClassId = p.ClassId
                gmd.GradeFrom = 130
                gmd.GradeTo = 149
                gmd.GradeDescription = "ΕΠΙΤΥΧΙΑ+"
                gmd.LetterGrade = "E+"
                gms.Add(gmd)

                gmd = GradeMappingFactory.Create
                gmd.ClassId = p.ClassId
                gmd.GradeFrom = 150
                gmd.GradeTo = 1000
                gmd.GradeDescription = "ΔΙΑΚΡΙΣΗ"
                gmd.LetterGrade = "Δ"
                gms.Add(gmd)
            Next

            Try
                gmdb.beginTrans()
                gmdb.saveList(gms)
                gmdb.commitTrans()

            Finally
                gmdb.rollbackTrans()
            End Try

            Console.WriteLine("Now UPDATE reporting columns for PAS periods")

            Dim pupdate As New PeriodClassDBUpdateHandler
            Dim peridos As List(Of PeriodClass) = PeriodClassDataUtils.findList("periodid in (select periodid from period where [DiplomaSuperTypeId] in (2,5))")

            For Each pc As PeriodClass In peridos
                pc.loadGradeMappings()
                pupdate.save(pc)
            Next

        End Sub

        Private Shared Sub createOldPASSctructure()

            'The cut-off date is 01-Jan-2009. Structure (Criteria) for ΠΑΣ: 
            'ΠΑΣ - Ανώτερο (3 Υποχρεωτικά + 2 Επιλογής) 
            'ΠΑΣ - Ανώτατο (3 Υποχρεωτικά + 4 Επιλογής) 
            'The lessons are the same ones that correspond to ΔΑΣ. 
            'The 3 mandatory ones are the same ones that are common to all 4 certificates of ΔΑΣ.


            Dim certificationType As CertificationType
            Dim cr As CertificationRequirement
            Dim lessons As List(Of Lesson) = LessonDataUtils.findList()
            Dim pas1lessons As String

            Dim dimplomaType As DiplomaType

            dimplomaType = DiplomaTypeFactory.Create
            dimplomaType.DiplomaType = "ΠΑΣ ΚΥΠΡΟΥ - Ανώτερο"
            dimplomaType.DiplomaSuperTypeId = 2

            pas1lessons = "C010,C020,C030,560,610,625,945"

            certificationType = CertificationTypeFactory.Create
            certificationType.CertificationType = "Πιστοποιητικό Ασφαλιστικών Σπουδών - Ανώτερο"
            certificationType.DiplomaSuperTypeId = 2
            certificationType.NumberOptionalRequired = 2
            For Each ls As Lesson In lessons
                'Debug.Print(ls.LessonCode)
                'If ls.LessonCode = "945" Then Stop
                If pas1lessons.Contains(ls.LessonCode) Then
                    cr = CertificationRequirementFactory.Create
                    cr.LessonId = ls.LessonId
                    cr.IsOptional = (ls.LessonCode <> "C010") AndAlso (ls.LessonCode <> "C020") AndAlso (ls.LessonCode <> "C030")
                    certificationType.AddCertificationRequirement(cr)
                End If
            Next

            dimplomaType.AddCertificationRequirement(certificationType)
            DiplomaTypeDataUtils.saveDiplomaType(dimplomaType)

            dimplomaType = DiplomaTypeFactory.Create
            dimplomaType.DiplomaType = "ΠΑΣ ΚΥΠΡΟΥ - Ανώτατο"
            dimplomaType.DiplomaSuperTypeId = 2

            certificationType = CertificationTypeFactory.Create
            certificationType.CertificationType = "Πιστοποιητικό Ασφαλιστικών Σπουδών  - Ανώτατο"
            certificationType.DiplomaSuperTypeId = 2
            certificationType.NumberOptionalRequired = 4
            For Each ls As Lesson In lessons
                If pas1lessons.Contains(ls.LessonCode) Then

                    cr = CertificationRequirementFactory.Create
                    cr.LessonId = ls.LessonId
                    cr.IsOptional = False
                    certificationType.AddCertificationRequirement(cr)

                End If
            Next

            dimplomaType.AddCertificationRequirement(certificationType)
            DiplomaTypeDataUtils.saveDiplomaType(dimplomaType)

            dimplomaType = DiplomaTypeFactory.Create
            dimplomaType.DiplomaType = "ΠΑΣ ΕΛΛΑΔΑΣ - Ανώτερο"
            dimplomaType.DiplomaSuperTypeId = 2

            pas1lessons = "GR10,GR20,GR30,560,610,625,945"

            certificationType = CertificationTypeFactory.Create
            certificationType.CertificationType = "Πιστοποιητικό Ασφαλιστικών Σπουδών - Ανώτερο"
            certificationType.DiplomaSuperTypeId = 2
            certificationType.NumberOptionalRequired = 2
            For Each ls As Lesson In lessons
                If pas1lessons.Contains(ls.LessonCode) Then
                    cr = CertificationRequirementFactory.Create
                    cr.LessonId = ls.LessonId
                    cr.IsOptional = (ls.LessonCode <> "GR10") AndAlso (ls.LessonCode <> "GR20") AndAlso (ls.LessonCode <> "GR30")
                    certificationType.AddCertificationRequirement(cr)
                End If
            Next

            dimplomaType.AddCertificationRequirement(certificationType)
            DiplomaTypeDataUtils.saveDiplomaType(dimplomaType)

            dimplomaType = DiplomaTypeFactory.Create
            dimplomaType.DiplomaType = "ΠΑΣ ΕΛΛΑΔΑΣ - Ανώτατο"
            dimplomaType.DiplomaSuperTypeId = 2

            certificationType = CertificationTypeFactory.Create
            certificationType.CertificationType = "Πιστοποιητικό Ασφαλιστικών Σπουδών  - Ανώτατο"
            certificationType.DiplomaSuperTypeId = 2
            certificationType.NumberOptionalRequired = 4
            For Each ls As Lesson In lessons
                If pas1lessons.Contains(ls.LessonCode) Then

                    cr = CertificationRequirementFactory.Create
                    cr.LessonId = ls.LessonId
                    cr.IsOptional = False
                    certificationType.AddCertificationRequirement(cr)

                End If
            Next

            dimplomaType.AddCertificationRequirement(certificationType)
            DiplomaTypeDataUtils.saveDiplomaType(dimplomaType)


        End Sub

        Private Shared Sub createCYNewDAS()

            Dim dimplomaType As DiplomaType
            Dim certificationType As CertificationType
            Dim cr As CertificationRequirement
            dimplomaType = DiplomaTypeFactory.Create
            dimplomaType.DiplomaType = "Δίπλωμα Ασφαλιστικών Σπουδών"
            dimplomaType.DiplomaSuperTypeId = 5

            certificationType = CertificationTypeFactory.Create
            certificationType.CertificationType = "Πιστοποιητικό Ασφαλιστικών Σπουδών στο Ασφαλιστικό Μάρκετιγκ"
            certificationType.DiplomaSuperTypeId = 5
            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("C010").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("C020").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("530").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("945").LessonId
            certificationType.AddCertificationRequirement(cr)
            dimplomaType.AddCertificationRequirement(certificationType)

            '--------------------
            certificationType = CertificationTypeFactory.Create
            certificationType.CertificationType = "Πιστοποιητικό Ασφαλιστικών Σπουδών Κλάδου Ζωής"
            certificationType.DiplomaSuperTypeId = 5
            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("C010").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("C020").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("530").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create

            cr.LessonId = LessonsCache.current.getLessonByCode("735").LessonId
            certificationType.AddCertificationRequirement(cr)
            dimplomaType.AddCertificationRequirement(certificationType)

            '---------------------------------------------------
            certificationType = CertificationTypeFactory.Create
            certificationType.CertificationType = "Πιστοποιητικό Ασφαλιστικών Σπουδών Κλάδου Μηχανοκίνητων Οχημάτων"
            certificationType.DiplomaSuperTypeId = 5
            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("C010").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("C020").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("530").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create

            cr.LessonId = LessonsCache.current.getLessonByCode("765").LessonId
            certificationType.AddCertificationRequirement(cr)
            dimplomaType.AddCertificationRequirement(certificationType)

            '---------------------------------------------------
            certificationType = CertificationTypeFactory.Create
            certificationType.CertificationType = "Πιστοποιητικό Ασφαλιστικών Σπουδών Κλάδου Περιουσίας"
            certificationType.DiplomaSuperTypeId = 5
            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("C010").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("C020").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("530").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create

            cr.LessonId = LessonsCache.current.getLessonByCode("745").LessonId
            certificationType.AddCertificationRequirement(cr)

            dimplomaType.AddCertificationRequirement(certificationType)

            DiplomaTypeDataUtils.saveDiplomaType(dimplomaType)
        End Sub

        Private Shared Sub createNewDASForGreece()

            Dim dimplomaType As DiplomaType
            Dim certificationType As CertificationType
            Dim cr As CertificationRequirement
            'create new DAS for Greece
            dimplomaType = DiplomaTypeFactory.Create
            dimplomaType.DiplomaType = "Δίπλωμα Ασφαλιστικών Σπουδών - Ελλάδα"
            dimplomaType.DiplomaSuperTypeId = 5

            certificationType = CertificationTypeFactory.Create
            certificationType.CertificationType = "E-Πιστοποιητικό Ασφαλιστικών Σπουδών στο Ασφαλιστικό Μάρκετιγκ"
            certificationType.DiplomaSuperTypeId = 5
            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("GR10").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("GR20").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("530").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("945").LessonId
            certificationType.AddCertificationRequirement(cr)
            dimplomaType.AddCertificationRequirement(certificationType)

            '--------------------
            certificationType = CertificationTypeFactory.Create
            certificationType.CertificationType = "E-Πιστοποιητικό Ασφαλιστικών Σπουδών Κλάδου Ζωής"
            certificationType.DiplomaSuperTypeId = 5
            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("GR10").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("GR20").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("530").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create

            cr.LessonId = LessonsCache.current.getLessonByCode("735").LessonId
            certificationType.AddCertificationRequirement(cr)
            dimplomaType.AddCertificationRequirement(certificationType)

            '---------------------------------------------------
            certificationType = CertificationTypeFactory.Create
            certificationType.CertificationType = "E-Πιστοποιητικό Ασφαλιστικών Σπουδών Κλάδου Μηχανοκίνητων Οχημάτων"
            certificationType.DiplomaSuperTypeId = 5
            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("GR10").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("GR20").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("530").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create

            cr.LessonId = LessonsCache.current.getLessonByCode("765").LessonId
            certificationType.AddCertificationRequirement(cr)
            dimplomaType.AddCertificationRequirement(certificationType)

            '---------------------------------------------------
            certificationType = CertificationTypeFactory.Create
            certificationType.CertificationType = "E-Πιστοποιητικό Ασφαλιστικών Σπουδών Κλάδου Περιουσίας"
            certificationType.DiplomaSuperTypeId = 5
            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("GR10").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("GR20").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create
            cr.LessonId = LessonsCache.current.getLessonByCode("530").LessonId
            certificationType.AddCertificationRequirement(cr)

            cr = CertificationRequirementFactory.Create

            cr.LessonId = LessonsCache.current.getLessonByCode("745").LessonId
            certificationType.AddCertificationRequirement(cr)

            dimplomaType.AddCertificationRequirement(certificationType)
            DiplomaTypeDataUtils.saveDiplomaType(dimplomaType)
        End Sub

        Private Shared Sub createNewDASSctructure()
            'as per online pdf

            Call createCYNewDAS()
            '---------------------GREEK Classes/certificates------------------------------------
            Call createNewDASForGreece()

        End Sub

        Private Shared Sub subjectConversion()

            Dim sbc As New SubjectConverter
            sbc.dataTransfer()



        End Sub



    End Class
End Namespace